home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok59.lha
/
AmokEd_V1.02b
/
txt
/
Printf.lzh
/
Printf
/
TXT
/
Printf.mod
< prev
next >
Wrap
Text File
|
1991-01-25
|
3KB
|
91 lines
(*
:Program. Printf
:Author. Volker Rudolph
:Address. Lettow-Vorbeck-Str. 11 / 6750 Kaiserslautern
:Phone. 06301/8566
:Version. 1.2
:Date. 7.3.1990
:Copyright. PD
:Language. Assembler / Oberon
:Translator. A68k / Amiga-Oberon V1.17.1
:Contents. Allzweck-Textausgabe in Form der C-Funktion Printf
:Usage. Aufruf und Parameter wie in C
*)
MODULE Printf;
IMPORT d:Dos;
CONST
(* Größe des Ausgabepuffers *)
(* Der Ausgabestring darf nicht länger sein *)
bufSize * = 120;
TYPE
(* Man kann jede Funktion dieses Typs als Ausgabeprozedur angeben *)
WriteProcType * = PROCEDURE(str:ARRAY OF CHAR);
VAR
(* Ausgabeprozedur *)
writeProc * :WriteProcType;
(* --------------------------------------------------------------- *)
PROCEDURE Printf0*{"Printf.Printf0"}(str:ARRAY OF CHAR);
PROCEDURE Printf1*{"Printf.Printf1"}(str:ARRAY OF CHAR;val1:LONGINT);
PROCEDURE Printf2*{"Printf.Printf2"}(str:ARRAY OF CHAR;val1,val2:LONGINT);
PROCEDURE Printf3*{"Printf.Printf3"}(str:ARRAY OF CHAR;val1,val2,val3:LONGINT);
PROCEDURE Printf4*{"Printf.Printf4"}(str:ARRAY OF CHAR;val1,val2,val3,val4:LONGINT);
PROCEDURE Printf5*{"Printf.Printf5"}(str:ARRAY OF CHAR;val1,val2,val3,val4,val5:LONGINT);
PROCEDURE Printf6*{"Printf.Printf6"}(str:ARRAY OF CHAR;val1,val2,val3,val4,val5,val6:LONGINT);
PROCEDURE SPrintf0 * {"Printf.SPrintf0"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR);
PROCEDURE SPrintf1 * {"Printf.SPrintf1"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1:LONGINT);
PROCEDURE SPrintf2 * {"Printf.SPrintf2"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1,val2:LONGINT);
PROCEDURE SPrintf3 * {"Printf.SPrintf3"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1,val2,val3:LONGINT);
PROCEDURE SPrintf4 * {"Printf.SPrintf4"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1,val2,val3,val4:LONGINT);
PROCEDURE SPrintf5 * {"Printf.SPrintf5"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1,val2,val3,val4,val5:LONGINT);
PROCEDURE SPrintf6 * {"Printf.SPrintf6"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1,val2,val3,val4,val5,val6:LONGINT);
(* ---------------------------------------------------------------- *)
(* $RangeChk- $OvflChk- $NilChk- $CopyArrays- *)
PROCEDURE WriteString*(str:ARRAY OF CHAR);
VAR
i:LONGINT;
out:d.FileHandlePtr;
BEGIN
i := 0;
WHILE (i < LEN(str)) AND (str[i] # 0X) DO INC(i) END;
out := d.Output();
IF (out = NIL) OR
(d.Write(out,str,i) # i) THEN
HALT(20)
END; (* END *)
END WriteString;
PROCEDURE WriteLn*;
BEGIN
writeProc("\n");
END WriteLn;
(* Hilfs-Prozedur, die von den Assembler-Routinen aufgerufen wird *)
(* $CopyArrays- *)
PROCEDURE WriteProc*(str:ARRAY OF CHAR);
BEGIN
writeProc(str);
END WriteProc;
(* ---------------------------------------------------------------- *)
BEGIN
writeProc := WriteString;
END Printf.